<template>
    <div class="page">
      <!-- 导航 开始 -->
      <nav-bar title="用户案例"></nav-bar>
      <!-- 导航 end -->
  
      <div class="case_list">
        <template v-if="caseList && caseList.length">
          <UserCase
            v-for="(item, index) in caseList"
            :key="index"
            :info="item"
          ></UserCase>
        </template>
        <no-data v-else></no-data>
      </div>
    </div>
  </template>
  <script>
  import UserCase from "@/components/case/index.vue";
  import { GET_HOSPITAL_USERCASES } from "@/http/interface";
  export default {
    components: {
      UserCase,
    },
    data() {
      return {
        caseList: [],
      };
    },
    head() {
      return {
        link: [
          {
            ref: "canonical",
            href: `${this.$domain}/hospital/case/${this.id}`,
          },
        ],
      };
    },
    async asyncData({ query, $axios,params }) {
      let _params = { id: params.id };
      let res = await $axios.get(GET_HOSPITAL_USERCASES, { params: _params });
      let caseList = res.data || [];
      return {
        caseList,
        id: params.id,
      };
    },
  };
  </script>
  <style lang="less" scoped>
  @import "/assets/styles/hospital/case.less";
  </style>